package cn.edu.zut.sunday.utils;

import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import lombok.experimental.UtilityClass;

@UtilityClass
public class DateUtils {

    public static final  String            DATE_FORMAT         = "yyyy-MM-dd HH:mm:ss";
    private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(
      DATE_FORMAT);

    public static String format(Date date) {
        return date.toInstant().atZone(ZoneId.systemDefault()).format(DATE_TIME_FORMATTER);
    }
}
